package com.epfresh.activity;


import android.os.Bundle;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.View;

import android.widget.ImageView;


import com.epfresh.R;

import com.epfresh.fragment.CartFragment;

import com.epfresh.global.BaseActivity;


public class CartActivity extends BaseActivity {

    CartFragment mCartFragment;
    String TAG_CART_FRAGMENT = "TAG_CART_FRAGMENT";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_cart);

        if (savedInstanceState != null) {

        }

        initView();

    }

    @Override
    protected View getToolBar() {
        return null;
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {

        super.onSaveInstanceState(outState);
    }

    private void initView() {
       

        FragmentManager fm = getSupportFragmentManager();

        FragmentTransaction transaction = fm.beginTransaction();

        Fragment f = fm.findFragmentByTag(TAG_CART_FRAGMENT);
        if (f != null && f instanceof CartFragment) {
            mCartFragment = (CartFragment) f;
        }
        if (mCartFragment == null) {
            mCartFragment = new CartFragment();
            mCartFragment.isShowBack = true;
            transaction.add(R.id.content, mCartFragment, TAG_CART_FRAGMENT);
        }
        mCartFragment.updateBack(true);
        transaction.show(mCartFragment);

        transaction.commit();

    }


}
